package org.visionlibrary.event.publisher;

import java.util.EventListener;
import java.util.EventObject;

/**
 * EventBroadcastExecutor is 
 *
 * @param <V> Type of the event that will be broadcasted to registered listeners.
 * @param <T> Type of listeners that are registered within the broadcast executor.
 */
public interface EventPublisher <V extends EventObject, T extends EventListener> {
	
	/**
	 * Adds the specified listener to the broadcast executor. An added listener
	 * will be notified of any fired events.
	 * 
	 * @param listener The listener to add to event broadcast executor.
	 */
	void addListener(T listener);
	
	/**
	 * Removes the specified listener from the event broadcast executor. Once
	 * removed the specified listener will no longer receive events.
	 * 
	 * @param listener The listener previously added to broadcast executor.
	 */
	void removeListener(T listener);
	
	/**
	 * Publishes specified event to the subscribed listener.
	 * 
	 * @param event Event that will be published.
	 * @param listener The listener subscribed for the event.
	 */
	void fireEvent(V event, T listener);
	
	/**
	 * Publishes specified event to the list of subscribed listeners.
	 * 
	 * @param event Event that will be published.
	 */
	void fireEvent(V event);
}
